package com.voute.View.Activity;

import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;

import com.voute.App.App;
import com.voute.Base.BaseActivity;
import com.voute.R;

/**
 * Created by Administrator on 2017/4/30.
 */

public class CenterActivity extends BaseActivity {
    @Override
    public int getLayoutId() {
        return R.layout.activity_center;
    }

    @Override
    public void setupView() {
        String action = getIntent().getAction();
        String hash="";
        String type="";
        if(TextUtils.isEmpty(action)){
            App.GetInstance().finishActivity(CenterActivity.this);
        }
        if(Intent.ACTION_VIEW.equals(action)){
            Uri uri = getIntent().getData();
            if(uri != null){
                hash = uri.getQueryParameter("value");
                type=uri.getQueryParameter("type");
                if("circle".equals(type)){
                    Intent intent=new Intent(this, CircleActivity.class);
                    intent.putExtra("KEY_CIRCLE_HASH",hash);
                    startActivity(intent);
                    App.GetInstance().finishActivity(CenterActivity.this);
                }
                else{
                    Intent intent=new Intent(this, FeedDetailInfoActivity.class);
                    intent.putExtra("KEY_FEED_HASH",hash);
                    startActivity(intent);
                    App.GetInstance().finishActivity(CenterActivity.this);
                }
            }
        }
        else{
            App.GetInstance().finishActivity(CenterActivity.this);
        }
    }

    @Override
    public void setupData() {

    }
}
